<div class="page">
	<div class="page-header">
		<h3><i class="icon-awesome-table icon-large"></i><span class="divider"></span><?php echo __('Bem Patrimonials');?>&nbsp;<small><?php echo ('Lista de Todos os Bens Patrimoniais');?></small></h3>
		<div class="page-header-options pull-right">
			<?php echo $this->Html->link('<i class="icon-plus icon-white"></i>'.__('Add').' '.__('Bem Patrimonials'), array('action' => 'add'), array('escape' => false, 'class' => 'btn btn-primary')); ?>
		</div>
	</div>
	<div class="page-content">
		
		<?php echo $this->Form->create('Filter', array('class' => 'well')); ?>
			<div class="input-append">
    			<?php echo $this->Form->input('Filter.descricao', array('type' => 'text', 'label' => false, 'div' => false, 'class' => 'span5', 'placeholder' => 'Digite a descrição do bem')); ?>
    			<?php echo $this->Form->button('<i class="icon-search icon-white"></i>&nbsp;Pesquisar', array('div' => false, 'class' => 'btn btn-primary', 'escape' => false)); ?>
    			<?php echo $this->Form->button('<i class="icon-awesome-remove icon-white"></i>', array('type' => 'button', 'div' => false, 'class' => 'btn btn-primary', 'escape' => false)); ?>
  			</div>
		<?php echo $this->Form->end();?>
	
		<table class="table table-bordered table-striped">
		<thead>
		<tr>
			<th width="10%"><?php echo $this->Paginator->sort('numero_bem', 'Nº Tombo');?></th>
			<th width="25%"><?php echo $this->Paginator->sort('produto_id', 'Produto');?></th>
			<th width="30%"><?php echo $this->Paginator->sort('descr_bem', 'Descrição do Bem');?></th>
			<th width="25%"><?php echo $this->Paginator->sort('grupo', 'Grupo');?></th>
			<th width="10%" class="actions"><?php echo __('Actions');?></th>
		</tr>
		</thead>
		<tbody>
<?php
		foreach ($bemPatrimonials as $bemPatrimonial): ?>
		<tr>
			<td><?php echo h($bemPatrimonial['BemPatrimonial']['numero_bem']); ?>&nbsp;</td>
			<td><?php echo $this->Html->link($bemPatrimonial['Produto']['descricao'], array('controller' => 'produtos', 'action' => 'view', $bemPatrimonial['Produto']['id'])); ?></td>
			<td><?php echo h($bemPatrimonial['BemPatrimonial']['descricao_bem']); ?>&nbsp;</td>
			<td><?php echo $this->Html->link($bemPatrimonial['Produto']['Grupo']['grupo'], array('controller' => 'contacontabils', 'action' => 'view', $bemPatrimonial['Produto']['grupo_id'])); ?></td>
			<td class="actions">
				<?php echo $this->Html->link('<i class="icon-eye-open icon-white"></i>', array('action' => 'view', $bemPatrimonial['BemPatrimonial']['id']), array('escape' => false, 'class' => 'btn btn-primary btn-mini')); ?>
				<?php echo $this->Html->link('<i class="icon-pencil icon-white"></i>', array('action' => 'edit', $bemPatrimonial['BemPatrimonial']['id']), array('escape' => false, 'class' => 'btn btn-primary btn-mini')); ?>
				<?php echo $this->Form->postLink('<i class="icon-trash icon-white"></i>', array('action' => 'delete', $bemPatrimonial['BemPatrimonial']['id']), array('escape' => false, 'class' => 'btn btn-danger btn-mini'), __('Are you sure you want to delete # %s?', $bemPatrimonial['BemPatrimonial']['id'])); ?>
			</td>
		</tr>
<?php endforeach; ?>
		</tbody>
		</table>
	</div>
	
	<div class="page-footer">
		<div class="row-fluid">
			<div class="span5"><p><?php echo $this->Paginator->counter(array(
					'format' => __('Página {:page} de {:pages}, exibindo de {:start} a {:end} de {:count} registros')
				)); ?></p>
			</div>
			<div class="span7 pagination pagination-small">
				<ul>
				<?php
					echo $this->Paginator->first(('<i class="icon-awesome-step-backward"></i>'), array('tag' => 'li', 'escape' => false));
					echo $this->Paginator->prev(('<i class="icon-awesome-backward"></i>'), array('tag' => 'li', 'escape' => false), null, array('class' => 'disabled', 'tag' => 'li', 'escape' => false));
					echo $this->Paginator->numbers(array('separator' => '', 'tag' => 'li', 'currentClass' => 'active'));
					echo $this->Paginator->next(('<i class="icon-awesome-forward"></i>'), array('tag' => 'li', 'escape' => false), null, array('class' => 'disabled', 'tag' => 'li', 'escape' => false));
					echo $this->Paginator->last(('<i class="icon-awesome-step-forward"></i>'), array('tag' => 'li', 'escape' => false));
				?>
				</ul>
			</div>
		</div>
	</div>
	
	<div id="modal-conta" class="modal hide fade" tabindex="-1"></div>
</div>


<script type="text/javascript">

	$(document).ready(function () {
		$('.actions > a.btn-primary').click(function(event){
			event.preventDefault();
			$("#modal-conta").html('');
			var url = $(this).attr('href');
            $.get(url, function (data) {
                $("#modal-conta").html(data);
                $("#modal-conta").modal().css({'width':'900px',
                    'margin-top': function () {  
                        return (($(this).height() / 2) * (-1));  
                    },  
                    'margin-left': function () {  
                       return (($(this).width() / 2) * (-1));  
                     }});  
            });
		});
	});

</script>